package com.viknix.threadpool.manager.cluster.lookup;

import com.viknix.threadpool.manager.cluster.core.Member;
import com.viknix.threadpool.manager.cluster.core.ServerMemberManager;
import com.viknix.threadpool.manager.server.dependence.exception.ServerProcessException;

import java.util.Collection;

/**
 * @Author: Dongqi
 * @Date: 2021/11/10 19:19
 * @Version 1.0
 * @Description: 成员节点寻址方式
 */
public interface MemberLookup {

    /**
     * start.
     *
     * @throws com.viknix.threadpool.manager.server.dependence.exception.ServerProcessException serverProcessException
     */
    void start() throws ServerProcessException;

    /**
     * 注入 ServerMemberManager 属性。
     *
     * @param memberManager {@link ServerMemberManager}
     */
    void injectMemberManager(ServerMemberManager memberManager);

    /**
     * 判断集群节点是否有变更
     *
     * @param members {@link Collection} 新的集群节点信息
     */
    void afterLookup(Collection<Member> members);

    /**
     * Addressing mode closed.
     *
     * @throws ServerProcessException serverProcessException
     */
    void destroy() throws ServerProcessException;
}
